<!doctype html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="__ADMIN__/css/base.css" />
<link rel="stylesheet" href="__ADMIN__/css/info-reg.css" />
<title>移动办公自动化系统</title>
</head>

<body>
<div class="title"><h2>文章修改</h2></div>
<form id="uploadForm">
	<div class="main">
	    <p class="short-input ue-clear">
	    	<label>标题：</label>
	        <input type="text" name="title" placeholder="部门名称" value="{$data.title}" />
	        <input type="hidden" name="id" value="{$data.id}">
	    </p>
	    <p class="short-input ue-clear">
	    	<label>内容：</label>
	        <script id="editor" name="content" type="text/plain" style="width:90%;height:500px;float:left;">{$data.content|htmlspecialchars_decode}</script>
	    </p>
        <p class="short-input ue-clear">
            <label>图片：</label>
            <input name="thumb" type="file" />
            <!-- <input type="hidden" name="thumb" value="{$data.thumb}"> -->
        </p>
        <p class="short-input ue-clear">
            <label>附件：</label>
            <input name="file" type="file" />
            <!-- <input type="hidden" name="filepath" value="{$data.filepath}">
            <input type="hidden" name="filename" value="{$data.filename}"> -->
        </p>

        <p class="short-input ue-clear">
            <label>作者：</label>
            <input name="author" type="text" value="{$data.author}" placeholder="作者..." />
        </p>
	</div>
	<div class="btn ue-clear">
		<a href="javascript:;" id="btnsubmit" class="confirm">确定</a>
	    <a href="javascript:;" id="btncancel" class="clear">返回</a>
	</div>
</form>
</body>
<script type="text/javascript" src="__ADMIN__/js/jquery.js"></script>
<script type="text/javascript" src="__ADMIN__/js/common.js"></script>
<script type="text/javascript" src="__ADMIN__/js/WdatePicker.js"></script>
<script type="text/javascript" src="__ADMIN__/plugin/ue/ueditor.config.js"></script>
<script type="text/javascript" src="__ADMIN__/plugin/ue/ueditor.all.min.js"></script>
<script type="text/javascript" src="__ADMIN__/plugin/ue/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript" src="__ADMIN__/plugin/layer/layer.js"></script>
<script type="text/javascript">
$(function(){
    var ue = UE.getEditor('editor');
})
    

$(".select-title").on("click",function(){
	$(".select-list").toggle();
	return false;
});
$(".select-list").on("click","li",function(){
	var txt = $(this).text();
	$(".select-title").find("span").text(txt);
});


showRemind('input[type=text], textarea','placeholder');
$('#btnsubmit').click(function(){
	//$('form').submit();
    var formData = new FormData($("#uploadForm")[0]); 
    $.ajax({
        type: 'POST',
        url: '__CONTROLLER__/edit',
        data:formData,
        async:false,
        cache: false,  
        contentType: false,  
        processData: false,  
        success: function(data){
            console.log(data);
            if(data.status=='1'){
                layer.alert(data.msg,function(){
                    var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
                    parent.layer.close(index);
                });
                
            }
            else{
                layer.alert(data.msg);
            }
        },
        error:function(){
            layer.alert(data.msg);
        }
    });
})
$('#btncancel').click(function(){
	var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
    parent.layer.close(index);
})
</script>
</html>
